package com.supercube.sport.yoga.service.impl;

import com.supercube.common.utils.DateUtils;
import com.supercube.sport.yoga.dao.MemberBodyInfoMapper;
import com.supercube.sport.yoga.domain.MemberBodyInfoDTO;
import com.supercube.sport.yoga.service.MemberBodyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MemberBodyInfoServiceImpl implements MemberBodyInfoService {

    @Autowired
    private MemberBodyInfoMapper memberBodyInfoMapper;

    @Override
    public int save(MemberBodyInfoDTO dto) {
        dto.setBodyExaminationTime(DateUtils.getDate());
        return memberBodyInfoMapper.insert(dto);
    }

    @Override
    public int update(MemberBodyInfoDTO dto) {
        return memberBodyInfoMapper.updateByPrimaryKey(dto);
    }

    @Override
    public int deleteMemberBodyInfoById(String id) {
        return memberBodyInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public MemberBodyInfoDTO queryMemberBodyInfo(String id) {
        return memberBodyInfoMapper.selectByPrimaryKey(id);
    }
}
